package com.hly.basickotlin.fragment

import android.os.Bundle
import android.support.v4.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import com.hly.basickotlin.R
import android.support.v4.widget.DrawerLayout
import android.widget.Button
import android.widget.RelativeLayout
import kotlinx.android.synthetic.main.me_fragment.*

/**
 * ~~~~~~文件描述:~~~~~~
 * ~~~~~~作者:huleiyang~~~~~~
 * ~~~~~~创建时间:2018/7/12~~~~~~
 * ~~~~~~更改时间:2018/7/12~~~~~~
 * ~~~~~~版本号:1~~~~~~
 *
 */
class MeFragment : Fragment() {

    var drawerLayout: DrawerLayout? = null
    private var left: RelativeLayout? = null
    private var right: RelativeLayout? = null
    private var btn: Button? = null
    private var btn1: Button? = null

    override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
        val view = inflater!!.inflate(R.layout.me_fragment, container, false)

        drawerLayout = view.findViewById(R.id.me_drawer)
        left = view.findViewById(R.id.rleft_drawer_layout)
        btn = view!!.findViewById(R.id.btn)
        btn!!.setOnClickListener {
            if (drawerLayout!!.isDrawerOpen(this!!.left!!)) {
                drawerLayout!!.closeDrawer(this!!.left!!)
            } else {
                drawerLayout!!.openDrawer(this!!.left!!)
            }
        }
        right = view.findViewById(R.id.rright_drawer_layout)
        btn1 = view.findViewById(R.id.btn1)
        btn1!!.setOnClickListener {
            if (drawerLayout!!.isDrawerOpen(this!!.right!!)) {
                drawerLayout!!.closeDrawer(this!!.right!!)
            } else {
                drawerLayout!!.openDrawer(this!!.right!!)
            }
        }


        return view
    }


}